<?php

Class View {

    /*
     * @the base
     * @access private
     */
    private $base;

    /*
     * @Variables array
     * @access private
     */
    private $vars = array();

    /**
     *
     * @constructor
     *
     * @access public
     *
     * @return void
     *
     */
    function __construct($base) {
            $this->base = $base;

    }


     /**
     *
     * @set undefined vars
     *
     * @param string $index
     *
     * @param mixed $value
     *
     * @return void
     *
     */
     public function __set($index, $value)
     {
            $this->vars[$index] = $value;
     }


    function show($name) {
            $path = __SITE_PATH . '/view' . '/' . $name . '.php';

            if (file_exists($path) == false)
            {
                    throw new Exception('Template not found in '. $path);
                    return false;
            }

            /* Load variables */
            foreach ($this->vars as $key => $value)
            {
                    $$key = $value;
            }

            include ($path);
    }


}

?>